package enums

type ContentTypeEnum int

const (
	Json ContentTypeEnum = iota + 1
	XWwwFormUrlencoded
)

type ContType struct {
	Name string
}

func (it ContentTypeEnum) Get() ContType {
	switch it {
	case Json:
		return ContType{Name: "application/json"}
	case XWwwFormUrlencoded:
		return ContType{Name: "application/x-www-form-urlencoded"}
	default:
		return ContType{}
	}
}

func GetContentType(typeName string) ContType {
	switch typeName {
	case Json.Get().Name:
		return Json.Get()
	case XWwwFormUrlencoded.Get().Name:
		return XWwwFormUrlencoded.Get()
	default:
		return ContType{}
	}
}
